﻿
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>

    <script src='../Script/easyui/jquery.min.js'></script>
    <script src='../Script/easyui/jquery.easyui.min.js'></script>
    <script src='../Script/easyui/locale/easyui-lang-zh_CN.js'></script>
    <link href="../Script/easyui/themes/default/easyui.css" rel="stylesheet" id="easyuiTheme"  />
    <link href="Script/easyui/themes/icon.css" rel="stylesheet" />
    <script src='../Script/changeEasyUITheme.js'></script>
    <link href="CSS/list.css" rel="stylesheet" />
    <script src='../ckeditor/ckeditor.js'></script>
    
    <!--<script src="../js/cameraop.js"></script>-->

    <script language="javascript" for="preview" event="MsgNotify(iMsg,iError,szDetail,lWnd,szIndexCode)">
        szMsg = "msg:" + iMsg + ",error:" + iError + ",detail:" + szDetail + "，IndexCode：" + szIndexCode;
        document.frmApp.Result.value = szMsg;
        //return;
        //alert(szMsg);
        //0x02000007事件，控件加载完成时抛出的消息，此时平台根据需要调用以下接口对控件进行初始化
        //（控件内部默认也对应设置了固定参数，但生产现场要使用上次用户设置保存的参数，需要平台把上一次保存的数据设置进去）
        if (iMsg == 0x02000007) {
            var _right = "10034,10033,10032,10020,10027,10014,10001,10028,10002,10015,10005,10010,10024,10006,10011,10003,10021,10012,10022,10004,10013,10009,10029";
            preview.SetRightCode(_right);
            var _toolbar = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
				+ "<ToolBar><Item type=\"0\" /><Item type=\"24\" /><Item type=\"5\" />"
				+ "<Item type=\"6\" /><Item type=\"7\" /><Item type=\"8\" />"
				+ "<Item type=\"9\" /><Item type=\"10\" /><Item type=\"12\" />"
				+ "<Item type=\"17\" /><Item type=\"20\" /><Item type=\"21\" />"
				+ "<Item type=\"22\" /><Item type=\"53\" /><Item type=\"54\" /></ToolBar>";
            preview.SetToolBar(_toolbar);//工具栏按钮
            preview.SetToolBarAlwaysShow(0);
            preview.SetInstPlayCfg(30);//即使回放播放时间
            var _snap = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
				+ "<SnapShot><PicType>jpeg</PicType><Quality>80</Quality><SnapMulti>1</SnapMulti>"
				+ "<SnapTimes>3</SnapTimes><TimeSpan>1</TimeSpan><SaveFolder>C:\\Users\\lichanghua\\Documents\\CSC\\capture\\</SaveFolder><KeyWords></KeyWords></SnapShot>";
            preview.SetSnapParam(_snap);//抓图参数设置
            var _record = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
				+ "<VideoRecord><PackType>0</PackType><MaxRecTime>0</MaxRecTime>"
				+ "<PackTime>100</PackTime><PackSize>100</PackSize><SaveFolder>C:\\Users\\lichanghua\\Documents\\CSC\\record\\</SaveFolder><KeyWords></KeyWords></VideoRecord>";
            preview.SetRecordParam(_record);//录像参数设置
        }
    </script>

    <script type="text/javascript">
        var strXmlConfig = "";//摄像头配置文件
        var StartTime;
        var EndTime;
        var devid;

        var mq_indexCode = "";
        var mq_ip = "";
        var mq_port = "";
        var mq_username = "";
        var mq_password = "";

        $(function () {
            $.ajax({
                type: "post",
                dataType: "json",
                url: "GetWeather.ashx?action=queryMQ_QJ",
                success: function aa(data) {
                    strXmlConfig = data.rows[0].mmark;

                    mq_indexCode = data.rows[0].mq_indexCode;
                    mq_ip = data.rows[0].mq_ip;
                    mq_port = data.rows[0].mq_port;
                    mq_username = data.rows[0].mq_username;
                    mq_password = data.rows[0].mq_password;

                    //alert("1111:"+mq_indexCode + "--" + mq_ip + "--" + mq_port + "--" + mq_username + "--" + mq_password );
                    LoginPlat();
                    showxc();
                    
                }
            });


        });


        function showVideoPlayBack() {
            //top.addTab(devid, 'mywinvideoplayback.html');
            window.location.href = "mywinvideoplayback.html";
            //window.open("mywinvideoplayback.html");
        }

        //function showCamera() {
        //    //alert("1");
        //    if (strXmlConfig != "") {
        //        //alert(strXmlConfig);

        //        setWndNum(1);
        //        startPreview(strXmlConfig);
        //    }
        //}

        function showxc() {
            year = new Date().getFullYear();
            $('#jd').combobox({
                onSelect: function (newValue, oldValue) {
                    if (newValue.text == '一季度') {
                        $("#StartTime").datebox("setValue", year + "-1-1");
                        $("#EndTime").datebox("setValue", year + "-3-31");
                    }
                    else if (newValue.text == '二季度') {
                        $("#StartTime").datebox("setValue", year + "-4-1");
                        $("#EndTime").datebox("setValue", year + "-6-30");
                    }
                    else if (newValue.text == '三季度') {
                        $("#StartTime").datebox("setValue", year + "-7-1");
                        $("#EndTime").datebox("setValue", year + "-9-30");
                    }
                    else if (newValue.text == '四季度') {
                        $("#StartTime").datebox("setValue", year + "-10-1");
                        $("#EndTime").datebox("setValue", year + "-12-31");
                    }
                    else if (newValue.text == '当天') {
                        var curr_time = new Date();
                        var tc_time = new Date(curr_time.getTime() + 24 * 60 * 60 * 1000);
                        var strDate = curr_time.getFullYear() + "-";
                        strDate += curr_time.getMonth() + 1 + "-";
                        strDate += curr_time.getDate();
                        var strDateend = tc_time.getFullYear() + "-";
                        strDateend += tc_time.getMonth() + 1 + "-";
                        strDateend += tc_time.getDate();
                        $("#StartTime").datebox("setValue", strDate);
                        $("#EndTime").datebox("setValue", strDateend);
                    }
                }
            });
            var curr_time = new Date();
            var tc_time = new Date(curr_time.getTime() + 24 * 60 * 60 * 1000);
            var strDate = curr_time.getFullYear() + "-";
            strDate += curr_time.getMonth() + 1 + "-";
            strDate += curr_time.getDate();
            var strDateend = tc_time.getFullYear() + "-";
            strDateend += tc_time.getMonth() + 1 + "-";
            strDateend += tc_time.getDate();

            $("#StartTime").datebox("setValue", strDate);
            $("#EndTime").datebox("setValue", strDateend);
            StartTime = $("#StartTime").datebox("getValue");
            EndTime = $("#EndTime").datebox("getValue");
            $('#adddevid').val(devid);
            //InitGird();
            $("#yjfx").panel({
                href: '../html/alarmall.html',
                title: '视频监控预警信息',
                tools: [{ iconCls: 'icon-phone', handler: function () { sendAlarm('视频监控预警'); } }],
                onLoad: function () {
                    InitSendUser();
                    $("#btnyj").click(function () {
                        sendAlarm('视频监控预警');
                    });
                }

            });
            pageLoad();
        }
    </script>


    <SCRIPT type=text/javascript>
        function LoginPlat() {
            //Demo默认使用密码登录方式
            //var IP = document.frmApp.IP.value;
            //var port = document.frmApp.port.value;
            //var UserName = document.frmApp.UserName.value;
            //var Password = document.frmApp.Password.value;

            var IP = mq_ip;
            var port = mq_port;
            var UserName = mq_username;
            var Password = mq_password;

            var v1 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><LoginInfo><LoginType>2</LoginType><SynLogin>1</SynLogin><IP>" + IP + "</IP><Port>" + port
			+ "</Port><UserName>" + UserName + "</UserName><Password>" + Password + "</Password></LoginInfo>";
            //alert(v1);

            //alert(mq_indexCode + "--" + mq_ip + "--" + mq_port + "--" + mq_username + "--" + mq_password);
            var v = preview.LoginPlat(v1);
            if (v != 0)
                alert("登录失败，请查看日志preview.log");
            var hm = $('#mymap').height();
            $("#mymq").height(hm);
            var my1 = $('#my1').height();
            var yj = $('#yjfx').height();
            var myh = parseInt(my1) + parseInt(yj)+30;
            $('#mym').height(myh);
        }

        //新的预览接口，需先登录平台，登录需要耗点时间，稍等（控件自身取Token）
        function StartPreview() {
            //var Code = document.frmApp.CameraIndexCode.value;
            var Code = mq_indexCode;
            var _param = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Preview><CamIndexCode>" + Code + "</CamIndexCode></Preview>";
           
            //alert(Code);
           
            preview.StartPreview(_param);
        }

        //老预览接口：控件仍然抛事件给平台，由平台传入Token
        //2015.10.8之前的版本，老接口预览，没登录平台token会为空，如果服务要验证token，预览会失败，只能通过登录平台方式预览
        function StartPreviewEx() {
            //var IP = document.frmApp.VAGIP.value;
            //var port = document.frmApp.VAGPort.value;
            //var Code = document.frmApp.CameraIndexCode.value;

            var IP = mq_ip;
            var port = mq_port;
            var Code = mq_indexCode;

            //根据平台不同的取流配置方式，控件开始预览接口StartPreviewEx(BSTR szXml)包含以下三种情况
            //取流方式一：过Vag直连取流(非级联)
            var stream_vag_param = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Preview>"
				       + "<StreamSvr>"
					   + "<Svr type=\"3\" ip=\"" + IP + "\" port=\"" + port + "\"/>"						  //过Vag直连取流：提供监控点所在的Vag服务IP和端口
					   + "</StreamSvr>"
					   + "<CamIndexCode>" + Code + "</CamIndexCode>"						              //监控点编号：对应平台监控点信息"c_index_code"字段
					   + "<CamName>小区Camera01</CamName>"										      //监控点名称：对应平台监控点信息"c_name"字段
					   + "<DevIndexCode>10000000001130000003</DevIndexCode>"                          //监控点所在设备编号：对应平台监控点信息"c_device_index_code"字段
					   + "<LinkType>1</LinkType>"									                  //取流连接协议：1~TCP(默认), 2~UDP，对应平台监控点信息"i_stream_link_type"字段
					   + "<StreamType>0</StreamType>"                								  //码流类型：0~主码流, 1~子码流,对应平台监控点信息"i_stream_type"字段
					   + "<ChannelNo>1</ChannelNo>"										              //监控点所在设备通道号：对应监控点信息“i_channel_no”字段
					   + "<NetZone cnid=\"1\" pnid=\"1\"/>"											  //客户端和设备所在网域Id，内网~1(默认)，外网~2，pnid对应设备信息"i_netDemain_id"字段
					   + "<UserLevel>50</UserLevel>"											      //平台用户等级，50~系统管理员
					   + "<DevType>0</DevType>"												          //监控点所在设备设备厂商类型：0~海康，1~大华，其他参考平台设备,对应平台设备信息"i_device_detail_type"字段
					   + "<ProSeries>1</ProSeries>"											          //监控点所在设备对应产品系列,对应平台设备信息"i_manufacturer"字段
					   + "<TreatyType>SDK</TreatyType>"												  //监控点所在设备产品接入协议：SDK~海康SDK设备, EHOME~EHOME设备, GB28181~国标设备等,对应平台设备信息"c_treaty_type"字段
					   + "<UserName>admin</UserName>"												  //监控点所在设备用户名,对应平台设备信息"c_user_name"字段
					   + "<PassWord>XdMOANI=</PassWord>" 											  //监控点所在设备密码,对应平台设备信息"c_user_pwd"字段
					   + "<FishEyeInfo><InstallType></InstallType><VideoDevType>16</VideoDevType></FishEyeInfo>" //[可选]对于鱼眼监控点使用：安装方式和设备类型
					   + "</Preview>";

            //取流方式二：过流媒体取流(非级联)
            var stream_vtm_param = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Preview>"
				       + "<StreamSvr>"																  //过流媒体取流需同时提供Vag服务和流媒体服务信息，其中流媒体服务可以是Vtm或Vtdu，取决于平台配置的服务
					   + "<Svr type=\"3\" ip=\"10.33.30.205\" port=\"7302\"/>"   					  //Vag服务
					   + "<Svr type=\"4\" ip=\"10.33.30.205\" port=\"557\"/>"						  //Vtm或Vtdu服务
					   + "</StreamSvr>"
					   + "<CamIndexCode>10000000001310000019</CamIndexCode>"						  //监控点编号：对应平台监控点信息"c_index_code"字段
					   + "<CamName>小区Camera01</CamName>"										      //监控点名称：对应平台监控点信息"c_name"字段
					   + "<DevIndexCode>10000000001130000003</DevIndexCode>"                          //监控点所在设备编号：对应平台监控点信息"c_device_index_code"字段
					   + "<LinkType>1</LinkType>"									                  //取流连接协议：1~TCP(默认), 2~UDP，对应平台监控点信息"i_stream_link_type"字段
					   + "<StreamType>0</StreamType>"                								  //码流类型：0~主码流, 1~子码流,对应平台监控点信息"i_stream_type"字段
					   + "<ChannelNo>1</ChannelNo>"										              //监控点所在设备通道号：对应监控点信息“i_channel_no”字段
					   + "<NetZone cnid=\"1\" pnid=\"1\"/>"											  //客户端和设备所在网域Id，内网~1(默认)，外网~2，pnid对应设备信息"i_netDemain_id"字段
					   + "<UserLevel>50</UserLevel>"											      //平台用户等级，50~系统管理员
					   + "<DevType>0</DevType>"												          //监控点所在设备设备厂商类型：0~海康，1~大华，其他参考平台设备,对应平台设备信息"i_device_detail_type"字段
					   + "<ProSeries>1</ProSeries>"											          //监控点所在设备对应产品系列,对应平台设备信息"i_manufacturer"字段
					   + "<TreatyType>SDK</TreatyType>"												  //监控点所在设备产品接入协议：SDK~海康SDK设备, EHOME~EHOME设备, GB28181~国标设备等,对应平台设备信息"c_treaty_type"字段
					   + "<UserName>admin</UserName>"												  //监控点所在设备用户名,对应平台设备信息"c_user_name"字段
					   + "<PassWord>XdMOANI=</PassWord>" 											  //监控点所在设备密码,对应平台设备信息"c_user_pwd"字段
					   + "<FishEyeInfo><InstallType></InstallType><VideoDevType>16</VideoDevType></FishEyeInfo>" //[可选]对于鱼眼监控点使用：安装方式和设备类型
					   + "</Preview>";

            //取流方式三：级联过NCG取流
            var stream_ncg_param = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Preview>"
				       + "<StreamSvr>"																  //级联取流提供NCG服务的IP和端口
					   + "<Svr type=\"8\" ip=\"10.33.30.205\" port=\"7099\"/>"   					  //NCG服务
					   + "</StreamSvr>"
					   + "<CascCode>999999990020000000022</CascCode>"								  //级联监控点编码标志，通过该字段区分是否为级联监控点及是否级联过NCG取流，对应平台监控点信息"c_cascade_privilege"字段
					   + "<DecodeTag>hikvision</DecodeTag>"											  //级联监控点编码标志：hikvision~海康设备，dahua~大华设备，db33~国标设备，通过该字段区别进行解码播放，对应平台监控点信息"c_decode_tag"字段
					   + "<CamIndexCode>10000000001310000019</CamIndexCode>"						  //监控点编号
					   + "<CamName>Camera01</CamName>"												  //监控点名称
					   + "<ChannelNo>1</ChannelNo>"													  //监控点所在设备通道号
					   + "<NetZone cnid=\"1\" pnid=\"\"/>"					   					          //客户端和设备所在网域Id，内网~1，外网~2，注：级联时无设备信息
					   + "<LinkType>1</LinkType>"													  //[预留，暂不使用]取流连接协议：1~TCP(默认), 2~UDP
					   + "<StreamType>0</StreamType>"												  //[预留，暂不使用]码流类型：0~主码流, 1~子码流
					   + "</Preview>";

            //alert(stream_vag_param);
            preview.StartPreviewEx(stream_vag_param);
        }

        function StopPreview() {
            var idx = preview.GetSelWnd();
            preview.StopPreview(idx);
        }

        function StopAll() {
            var v = preview.StopPreview(-1);
        }

        //以下接口可能不常用，请按需求使用
        function PtzControl() {
            //var Code = document.frmApp.CameraIndexCode.value;
            var vFunid = document.frmApp.FunId.value;
            var CmdId = document.frmApp.CmdId.value;
            var vSpeed = document.frmApp.Speed.value;

            var Code = mq_indexCode;

            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
                                + "<PtzControl><FunId>" + vFunid + "</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify><Param>1</Param>"
                                + "<ControInfo><CmdId>" + CmdId + "</CmdId><Action></Action><Speed>" + vSpeed + "</Speed></ControInfo>"
                                + "<PresetInfo><Info No=\"1\" Name=\"2\" Type=\"1\" /><Info No=\"2\" Name=\"3\" Type=\"2\" /></PresetInfo>"
                                + "<CruiseInfo><Info No=\"1\" Dwell=\"1\" Speed=\"1\" /><Info No=\"2\" Dwell=\"2\" Speed=\"2\" /></CruiseInfo></PtzControl>";
            //alert(_param);
            var v = preview.PtzControl(_param);
            alert(v);
        }

        function AddSecuriteZone()//添加信任站点
        {
            //var IP = document.frmApp.IP.value;

            var IP = mq_ip;
            var v = preview.AddSecuriteZone(IP);
        }
        function EnterFishEye()//进入鱼眼模式
        {
            preview.EnterFishEye();
        }
        function ExitFishEye()//退出鱼眼模式
        {
            preview.ExitFishEye();
        }
        function SetLayoutType()//设置窗口布局
        {
            var v = document.frmApp.Layout.value;
            preview.SetLayoutType(v);
        }
        function SetInstPlayCfg()//设置即时回放时间
        {
            var v1 = document.frmApp.data.value;
            var v = preview.SetInstPlayCfg(v1);
        }
        function GetVersion()//获取版本号
        {
            var v = preview.GetVersion();
            alert(v);
        }
        function SetPerCfgInfo()//设置性能计划，如预览大于9路自动切换为子码流，双击放大单窗口显示时自动切换为主码流
        {
            var v1 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><Per><ChgWndNum>9</ChgWndNum><AutoChg>1</AutoChg><DecodePer>5</DecodePer><PlayPer>0</PlayPer></Per>";
            var v = preview.SetPerCfgInfo(v1);
        }
        function EnableMenu()//设置鼠标右键菜单栏是否启用
        {
            var v1 = document.frmApp.data.value;
            var v = preview.EnableMenu(v1);
        }
        function GetDirectoryPath()//弹出目录选择框，返回最终用户选择的路径
        {
            var v = preview.GetDirectoryPath();
        }
        function GetSystemDrive()//获取当前系统驱动盘符
        {
            var v = preview.GetSystemDrive();
            alert(v);
        }
        function GetUserDocument()//获取用户文档目录
        {
            var v = preview.GetUserDocument();
            alert(v);
        }
        function GetSelWndIsPlay()//获取当前选中窗口是否在播放状态
        {
            var v = preview.GetSelWndIsPlay();
            alert(v);
        }

        function SetMainToolBarShow()//设置主工具栏的显示隐藏
        {
            var data = document.frmApp.data.value;
            preview.SetMainToolBarShow(data);
        }
        function SetToolBarVisible()//设置播放窗口的小工具栏的显示隐藏
        {
            var data = document.frmApp.data.value;
            preview.SetToolBarVisible(data);
        }
        function EnableSysCfgButton()//设置系统设置按钮的使能控制
        {
            var data = document.frmApp.data.value;
            preview.EnableSysCfgButton(data);
        }

        function ShowFullScreenButton()//设置切换全屏按钮的显示隐藏
        {
            var data = document.frmApp.data.value;
            preview.ShowFullScreenButton(data);
        }

        //云镜控制各接口
        function zoomin()//焦距缩小
        {
            //var Code = document.frmApp.CameraIndexCode.value;
            var vSpeed = document.frmApp.Speed.value;

            var Code = mq_indexCode;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>12</CmdId><Action></Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";

            var v = preview.PtzControl(_param);
            //alert(v);
        }
        function zoomout()//焦距放大
        {
            //var Code = document.frmApp.CameraIndexCode.value;
            var vSpeed = document.frmApp.Speed.value;

            var Code = mq_indexCode;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>11</CmdId><Action></Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
            var v = preview.PtzControl(_param);
        }
        function qianyi()//焦点前移
        {
            //var Code = document.frmApp.CameraIndexCode.value;
            var vSpeed = document.frmApp.Speed.value;

            var Code = mq_indexCode;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>14</CmdId><Action></Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
            var v = preview.PtzControl(_param);
        }
        function houyi()//焦点后移
        {
            //var Code = document.frmApp.CameraIndexCode.value;
            var vSpeed = document.frmApp.Speed.value;

            var Code = mq_indexCode;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>13</CmdId><Action></Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
            var v = preview.PtzControl(_param);
        }
        function zoomin2()//光圈缩小
        {
            //var Code = document.frmApp.CameraIndexCode.value;
            var vSpeed = document.frmApp.Speed.value;

            var Code = mq_indexCode;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>16</CmdId><Action></Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
            var v = preview.PtzControl(_param);
        }
        function zoomout2()//光圈放大
        {
            //var Code = document.frmApp.CameraIndexCode.value;
            var vSpeed = document.frmApp.Speed.value;

            var Code = mq_indexCode;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>15</CmdId><Action></Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
            var v = preview.PtzControl(_param);
        }
        function lock()//锁定
        {
            //var Code = document.frmApp.CameraIndexCode.value;

            var Code = mq_indexCode;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>1</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify><Param>60</Param></PtzControl>";//60秒
            var v = preview.PtzControl(_param);
            alert(v);
        }
        function unlock()//解锁
        {
            //var Code = document.frmApp.CameraIndexCode.value;
            var Code = mq_indexCode;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>2</FunId> <CamIndexCode>" + Code + "</CamIndexCode><MsgNotify>0</MsgNotify></PtzControl>";//60秒
            var v = preview.PtzControl(_param);
            alert(v);
        }
        function DZoom()//设置当前窗口3D放大状态
        {
            //var Code = document.frmApp.CameraIndexCode.value;
            var Code = mq_indexCode;
            var vDZoom = document.frmApp.data.value;
            if (vDZoom != 0) {
                vDZoom = 1;
                document.frmApp.data.value = 0;
            }
            else
                document.frmApp.data.value = 1;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>3</FunId><CamIndexCode>" + Code + "</CamIndexCode><Param>" + vDZoom + "</Param></PtzControl>";
            var v = preview.PtzControl(_param);
            alert(v);
        }
        function dengguang() {
            var vOpen = document.frmApp.data.value;//控制打开还是关闭灯光
            if (vOpen != 0) {
                vOpen = 1;
                document.frmApp.data.value = 0;
            }
            else
                document.frmApp.data.value = 1;
            var Code = document.frmApp.CameraIndexCode.value;
            var vFunid = document.frmApp.FunId.value;
            var vSpeed = document.frmApp.Speed.value;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>2</CmdId><Action>" + vOpen + "</Action><Param></Param><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
            var v = preview.PtzControl(_param);
            alert(v);
        }
        function yushua() {
            var vOpen = document.frmApp.data.value;//控制打开还是关闭雨刷
            if (vOpen != 0) {
                vOpen = 1;
                document.frmApp.data.value = 0;
            }
            else
                document.frmApp.data.value = 1;

            var Code = document.frmApp.CameraIndexCode.value;
            var vFunid = document.frmApp.FunId.value;
            var vSpeed = document.frmApp.Speed.value;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>3</CmdId><Action>" + vOpen + "</Action><Param></Param><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
            var v = preview.PtzControl(_param);
            alert(v);
        }
        function scan() {
            //var Code = document.frmApp.CameraIndexCode.value;

            var Code = mq_indexCode;
            var vScan = document.frmApp.data.value;
            if (vScan != 0) {
                vScan = 1;
                document.frmApp.data.value = 0;
            }
            else
                document.frmApp.data.value = 1;

            var vSpeed = document.frmApp.Speed.value;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify><Param>0</Param>"
									+ "<ControInfo><CmdId>29</CmdId><Action>" + vScan + "</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
            var v = preview.PtzControl(_param);
        }
        //八方向
        function top()//向上
        {
            //var Code = document.frmApp.CameraIndexCode.value;

            var Code = mq_indexCode;
            var vSpeed = document.frmApp.Speed.value;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>21</CmdId><Action>0</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
            var v = preview.PtzControl(_param);
        }
        function righttop()//右上
        {
            //var Code = document.frmApp.CameraIndexCode.value;

            var Code = mq_indexCode;
            var vSpeed = document.frmApp.Speed.value;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>26</CmdId><Action>0</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
            var v = preview.PtzControl(_param);
        }
        function right()//向右
        {
            //var Code = document.frmApp.CameraIndexCode.value;

            var Code = mq_indexCode;
            var vSpeed = document.frmApp.Speed.value;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>24</CmdId><Action>0</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
            var v = preview.PtzControl(_param);
        }
        function rightbottom()//右下
        {
            //var Code = document.frmApp.CameraIndexCode.value;

            var Code = mq_indexCode;
            var vSpeed = document.frmApp.Speed.value;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>28</CmdId><Action>0</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
            var v = preview.PtzControl(_param);
        }
        function bottom()//向下
        {
            //var Code = document.frmApp.CameraIndexCode.value;

            var Code = mq_indexCode;
            var vSpeed = document.frmApp.Speed.value;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>22</CmdId><Action>0</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
            var v = preview.PtzControl(_param);
        }
        function leftbottom()//左下
        {
            //var Code = document.frmApp.CameraIndexCode.value;

            var Code = mq_indexCode;
            var vSpeed = document.frmApp.Speed.value;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>27</CmdId><Action>0</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
            var v = preview.PtzControl(_param);
        }
        function left()//向左
        {
            //var Code = document.frmApp.CameraIndexCode.value;

            var Code = mq_indexCode;
            var vSpeed = document.frmApp.Speed.value;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>23</CmdId><Action>0</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
            var v = preview.PtzControl(_param);
        }
        function lefttop()//左上
        {
            //var Code = document.frmApp.CameraIndexCode.value;

            var Code = mq_indexCode;
            var vSpeed = document.frmApp.Speed.value;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>25</CmdId><Action>0</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
            var v = preview.PtzControl(_param);
        }

        //设置预置点
        function SetPresetInfo() {
            //var Code = document.frmApp.CameraIndexCode.value;

            var Code = mq_indexCode;
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>7</FunId> <CamIndexCode>" + Code + "</CamIndexCode><MsgNotify>0</MsgNotify>"
									+ "<PresetInfo><Info No=\"1\" Name=\"1\" Type=\"1\" /></PresetInfo></PtzControl>";
            var v = preview.PtzControl(_param);
            alert(v);
        }

        //获取预置点
        function GetPresetInfo() {
            //var Code = document.frmApp.CameraIndexCode.value;

            var Code = mq_indexCode;
            var vType = document.frmApp.data.value;//预置点类型：1:预置点 2:巡航
            var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>5</FunId> <CamIndexCode>" + Code + "</CamIndexCode><Param>" + vType + "</Param></PtzControl>";
            var v = preview.PtzControl(_param);
            alert(v);
        }

        //642新增接口
        function EnterEagleEye() {
            var vCount = document.frmApp.data.value;//大鹰眼设备节点下监控点个数
            var v = preview.EnterEagleEye(v);
        }
        function ExitEagleEye() {
            var v = preview.ExitEagleEye();
        }
        function GetPtzTraceMode() {
            var v = preview.GetPtzTraceMode();
            alert(v);
        }
        function SetPtzTraceMode() {
            var vState = document.frmApp.data.value;//0或1
            var v = preview.SetPtzTraceMode(vState);
        }
        function SetBrowserType() {
            var vType = document.frmApp.data.value;//0或1
            var v = preview.SetBrowserType(vType);
        }
        function SwitchWindow() {
            var vIndex1 = document.frmApp.Speed.value;
            var vIndex2 = document.frmApp.data.value;
            var v = preview.SwitchWindow(vIndex1, vIndex2);
            alert(v);
        }
        function SetPlayWndStateText() {
            var vData = document.frmApp.Result.value;//0或1
            var vIndex = document.frmApp.data.value;
            var v = preview.SetPlayWndStateText(vIndex, vData);
        }
    </SCRIPT>


    <SCRIPT>
        function LoginPlatPlayBack() {
            //Demo默认使用密码登录方式
            //var IP = document.frmApp.IP.value;
            //var port = document.frmApp.port.value;
            //var UserName = document.frmApp.UserName.value;
            //var Password = document.frmApp.Password.value;

            var IP = mq_ip;
            var port = mq_port;
            var UserName = mq_username;
            var Password = mq_password;

            var v1 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><LoginInfo><LoginType>2</LoginType><IP>" + IP + "</IP><Port>" + port
			+ "</Port><UserName>" + UserName + "</UserName><Password>" + Password + "</Password></LoginInfo>";
            //alert(v1);
            var v = playback.LoginPlat(v1);
            if (v != 0)
                alert("登录失败，请查看日志playback.log");

            var hm = $('#mymap').height();
            $("#mymq").height(hm);
            var my1 = $('#my1').height();
            var yj = $('#yjfx').height();
            var myh = parseInt(my1) + parseInt(yj) + 30;
            $('#mym').height(myh);
        }
        function OnInit() {
			document.getElementById('ocxContainer').innerHTML = '<object classid="clsid:88F0ADA4-0B55-49EE-BD4E-FC87AD058DEF" id="playback"  width="800" height="600" name="ocx" ></object>';
			var _param = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
				+ "<PlaybackOcxConfig><DecodeEffect>0</DecodeEffect><PlayMode>0</PlayMode><SupportFishEye>1</SupportFishEye>"
				+ "<WindowToolbar><ShowMode>2</ShowMode><ShowItems><BtnItem>0</BtnItem><BtnItem>5</BtnItem><BtnItem>7</BtnItem>"
				+ "<BtnItem>12</BtnItem><BtnItem>17</BtnItem><BtnItem>21</BtnItem><BtnItem>32</BtnItem></ShowItems></WindowToolbar>"
				+ "<SnapParam><FileFormat>0</FileFormat><FilePath>C:\\Users\\huangjunyf2\\Documents\\capture\\</FilePath>"
				+ "<FileCategorization>0</FileCategorization><FileNameFormat></FileNameFormat><SnapMode>2</SnapMode>"
				+ "<ContinousNum>3</ContinousNum><ContinousMode>2</ContinousMode><ContinousInterval>1000</ContinousInterval></SnapParam>"
				+ "<ClipParam><FilePath>C:\\Users\\huangjunyf2\\Documents\\clip\\</FilePath><FileNameFormat></FileNameFormat><PackSize>256</PackSize></ClipParam>"
				+ "<DiskWarning><EnableDiskWarning>0</EnableDiskWarning><WarningSpace>500</WarningSpace><MinimumSpace>100</MinimumSpace></DiskWarning></PlaybackOcxConfig>";
			//alert(_param);
			playback.SetLocalParam(_param);
		}

		function OnPlayback(){
			var _param = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
				+ "<PlaybackBasicInfo><CameraName>Camera 051gvv</CameraName>"
				+ "<ServerType>1</ServerType><ServerIP>10.20.147.116</ServerIP><ServerPort>6300</ServerPort>"
				+ "<BeginTime>2016-01-08T00:00:00.000Z</BeginTime><EndTime>2016-01-08T23:59:59.000Z</EndTime>"
				+ "<SupportKFImg>1</SupportKFImg><CuInfo><UserName>admin</UserName><CuZoneId>1</CuZoneId>"
				+ "<CmsIp>10.20.147.116</CmsIp><CmsPort>80</CmsPort><CmsContext></CmsContext>"
				+ "<VmsIp>10.20.147.116</VmsIp><VmsPort>80</VmsPort><VmsContext></VmsContext></CuInfo>"
				+ "<RightCode>10034,10033,10032,10020,10027,10014,10001,10028,10002,10015,10005,10010,10024,10006,10011,10003,10021,10012,10022,10004,10013,10009,10029</RightCode>"
				+ "<CameraIndexCode>16395864001310000012</CameraIndexCode><DeviceInfo><DeviceName>Embedded Net DVR</DeviceName><DeviceIndexcode>16395864001310000012</DeviceIndexcode>"
				+ "<DeviceManufacturer>0</DeviceManufacturer><ProductSeries>1</ProductSeries></DeviceInfo><CascadeInfo><CascadeServerIp>10.20.147.116</CascadeServerIp>"
				+ "<CascadeServerPort>null</CascadeServerPort></CascadeInfo><PlaybackPerformance><DecodeEffect>5</DecodeEffect></PlaybackPerformance></PlaybackBasicInfo>";
			//alert(_param);
			var _index = playback.GetIdleWndIndex();
			playback.SetBasicInfo(_index, _param);
		}

		function OnPlaybackEx() {

		    var Code = mq_indexCode;

		    var beginTime = getNowFormatDate() + "T00:00:00.000Z";
		    var endTime = getNowFormatDate() + "T23:59:59.000Z";

			var _param = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
				+ "<PlaybackBasicInfo><CameraIndexCode>" + Code + "</CameraIndexCode>"
				+ "<StoreDeviceType>0</StoreDeviceType>"
				+ "<BeginTime>" + beginTime + "</BeginTime><EndTime>" + endTime + "</EndTime>"
				+ "</PlaybackBasicInfo>";

		    playback.SetBasicInfoEx(_param);

			//alert(_param);
		}

		function getNowFormatDate() {
		    var date = new Date();
		    var seperator1 = "-";
		    var seperator2 = ":";
		    var month = date.getMonth() + 1;
		    var strDate = date.getDate();
		    if (month >= 1 && month <= 9) {
		        month = "0" + month;
		    }
		    if (strDate >= 0 && strDate <= 9) {
		        strDate = "0" + strDate;
		    }
		    //var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
            //        + " " + date.getHours() + seperator2 + date.getMinutes()
		    //        + seperator2 + date.getSeconds();

		    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate;
		    return currentdate;
		}
    </SCRIPT>
</head>
<body>
        <div id="mymq" style="-ms-overflow-y: scroll;">
            <div id="cameraAare" style="overflow:auto;">
                <table>
                    <tr>
                        <td>
                            <object classid="clsid:BE020CC9-521F-4641-85E1-3B631B7ADDD9" id="preview" width="800" height="400" name="preview">
                               
                            </object>


                        </td>
                        <td>

                            <div style="margin-left:20px;">
                                <table>
                                    <tr>
                                        <td>
                                            <input type="button" name="mq_preview" onclick="showVideoPlayBack()"
                                                   style="background-image:url('../images/mq_preview.jpg'); width:62px;height:78px; border:0"
                                                   onmouseover="this.style.cursor='hand'">&nbsp;

                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <input type="button" name="mq_preview" onclick="StartPreview()"
                                                   style="background-image:url('../images/mq_photograph.jpg'); width:62px;height:78px; border:0"
                                                   onmouseover="this.style.cursor='hand'">&nbsp;
                                        </td>
                                    </tr>
                                </table>


                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            注：如不能正常显示图像，请下载并安装摄像头组件：<a href="../download/cmsocx.exe">摄像头组件</a>，
                            请使用IE8浏览器
                        </td>
                    </tr>
                </table>
            </div>
            <div id="mym" class="easyui-panel" style="overflow:visible;">
                <div class="easyui-panel" id="my1" data-options="title: '历史信息'" style="background: #eee; height: 450px;">
                    <table id="mtgrid"></table>
                    <div id="tab_toolbars" style="padding: 4px;">
                        <table cellpadding="0" cellspacing="0" style="width: 100%">
                            <tr>
                                <td style="padding-left: 2px">

                                    <div style="padding: 2px;">
                                        时间从:
                                        <input id="StartTime" class="easyui-datebox" style="width: 100px" />
                                        到:
                                        <input id="EndTime" class="easyui-datebox" style="width: 100px" />
                                        <select id="jd" class="easyui-combobox" name="jd" style="width: 80px;">
                                            <option value="季度">季度</option>
                                            <option value="一季度">一季度</option>
                                            <option value="二季度">二季度</option>
                                            <option value="三季度">三季度</option>
                                            <option value="四季度">四季度</option>
                                            <option value="当天">当天</option>
                                        </select>

                                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="reloadgrid()">查找</a>
                                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="Export('excel', $('#mtgrid'));">导出</a>
                                        <a href="#" onclick="newUser();" id="a_add" class="easyui-linkbutton" iconcls="icon-add">添加</a>
                                        <a href="#" onclick="remove();return false;" id="a_del" class="easyui-linkbutton" iconcls="icon-cancel">删除</a>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div id="yjfx" class="easyui-panel yjfx">

                </div>
                
            </div>
            
        </div>
  
   
</body>
</html>
